package com.xnj.file_buffer_stream_demo;

import java.io.*;

// 字符输入输出缓冲流
public class BufferReaderTest {
    public static void main(String[] args)  {
        try (
                FileReader reader = new FileReader("src/out.txt");
                // 创建字符缓冲输入流
                BufferedReader br = new BufferedReader(reader);
        ){

//            char[] buffer = new char[1024];
//            int len;
//            while ((len = br.read(buffer)) != -1){
//                System.out.print(new String(buffer, 0, len));
//            }

            // 字符缓存输入流新方法 readLine()
            String line;
            while ((line = br.readLine()) != null){
                System.out.println(line);
            }


        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
